﻿using System.ServiceModel;
using System.Threading;
using ShellCommandService.Contracts.DataContracts;
using ShellCommandService.Contracts.ServiceContracts;
using ShellCommandService.MSMQ;

namespace ShellCommandService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class ShellCommandService : IShellCommand
    {
        public ShellCommandResult Execute(ShellCommandInfo shellCommand)
        {
            IShellCommandQueueRepository commandRepository=ShellCommandQueueRepository.Instance;
            commandRepository.AddShellCommandsToQueue(shellCommand);
            Thread.Sleep(7000);
           
            ShellCommandResult shellComandResult = new ShellCommandResult();
            return shellComandResult;
        }
    }
}
